/**
 * Created by katiemi on 2017/11/20.
 */
$(function () {
    (function ($) {
        var $currentDetail ,$current,total = 0;;
        var Instrument = function () {}
        Instrument.prototype.remove = function (e) {
            $tbody = $(this).parent().parent().parent();
            $tr = $(this).parent().parent();
            $tr.remove();
            moneyTotal();
        }
        function showModel(){
            $('.deleteInstrument').on('click',Instrument.prototype.remove);
            $('#myModal').modal('show');
        }
        //直接填总金额
        function moneyTotal () {
            $('#instrumentTable .money').on('change',function () {
                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            $('#instrumentTable .money').on('mouseleave',function () {
                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            Instrument.prototype.calculateSumMoney();
            $("#myModalLabel font").text(total);
        }
        //单价x数量  费用自动计算
        function moneyPriceMulNum () {
            $('#instrumentTable .price,#instrumentTable .number').on('change',function () {
                var price =  Number($(this).parent().parent().find('.price').val());
                var number =  Number($(this).parent().parent().find('.number').val());
                $(this).parent().parent().find('.money').val(Math.round(price*number*10000)/10000);
                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            $('#instrumentTable .price,#instrumentTable .number').on('mouseleave',function () {
                var price =  Number($(this).parent().parent().find('.price').val());
                var number =  Number($(this).parent().parent().find('.number').val());
                $(this).parent().parent().find('.money').val(Math.round(price*number*10000)/10000);
                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            Instrument.prototype.calculateSumMoney();
            $("#myModalLabel font").text(total);
        }
        //人数x单价x数量  费用自动计算
        function moneyCountPriceMulNum () {
            $('#instrumentTable .count,#instrumentTable .price,#instrumentTable .number').on('change',function () {
                var count =  Number($(this).parent().parent().find('.count').val());
                var price =  Number($(this).parent().parent().find('.price').val());
                var number =  Number($(this).parent().parent().find('.number').val());
                $(this).parent().parent().find('.money').val(Math.round(count*price*number*10000)/10000);
                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            $('#instrumentTable .count,#instrumentTable .price,#instrumentTable .number').on('mouseleave',function () {
                var count =  Number($(this).parent().parent().find('.count').val());
                var price =  Number($(this).parent().parent().find('.price').val());
                var number =  Number($(this).parent().parent().find('.number').val());
                $(this).parent().parent().find('.money').val(Math.round(count*price*number*10000)/10000);
                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            Instrument.prototype.calculateSumMoney();
            $("#myModalLabel font").text(total);
        }
        //专家咨询费自动计算
        function specialistMoney () {
            $('#instrumentTable .days,#instrumentTable .invitePersonMeeting,#instrumentTable .invitePersonCommu,#instrumentTable .meetingStandard2,#instrumentTable .commuStandard').on('change',function () {
                var days =  Number($(this).parent().parent().find('.days').val());
                var invitePersonMeeting =  Number($(this).parent().parent().find('.invitePersonMeeting').val());
                var invitePersonCommu =  Number($(this).parent().parent().find('.invitePersonCommu').val());
                var meetingStandard2 =  Number($(this).parent().parent().find('.meetingStandard2').val());
                var commuStandard =  Number($(this).parent().parent().find('.commuStandard').val());
                $(this).parent().parent().find('.money').val(Math.round((days*invitePersonMeeting*meetingStandard2+days*invitePersonCommu*commuStandard)*10000)/10000);
                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            $('#instrumentTable .days,#instrumentTable .invitePersonMeeting,#instrumentTable .invitePersonCommu,#instrumentTable .meetingStandard2,#instrumentTable .commuStandard').on('mouseleave',function () {
                var days =  Number($(this).parent().parent().find('.days').val());
                var invitePersonMeeting =  Number($(this).parent().parent().find('.invitePersonMeeting').val());
                var invitePersonCommu =  Number($(this).parent().parent().find('.invitePersonCommu').val());
                var meetingStandard2 =  Number($(this).parent().parent().find('.meetingStandard2').val());
                var commuStandard =  Number($(this).parent().parent().find('.commuStandard').val());
                $(this).parent().parent().find('.money').val(Math.round((days*invitePersonMeeting*meetingStandard2+days*invitePersonCommu*commuStandard)*10000)/10000);
                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            Instrument.prototype.calculateSumMoney();
            $("#myModalLabel font").text(total);
        }
        //国际合作交流费自动计算
        function internationalCooperationMoney () {
            $('#instrumentTable .trafficFeeStandard,#instrumentTable .trafficFeeCount,#instrumentTable .trafficFee,#instrumentTable .accommodationFeeStandard,#instrumentTable .accommodationFeeCount,#instrumentTable .accommodationFeeDays,#instrumentTable .accommodationFee,#instrumentTable .incidentalsFeeCount,#instrumentTable .incidentalsFeeStandard,#instrumentTable .incidentalsFee').on('change',function () {
                var trafficFeeStandard =  Number($(this).parent().parent().find('.trafficFeeStandard').val());
                var trafficFeeCount =  Number($(this).parent().parent().find('.trafficFeeCount').val());
                $(this).parent().parent().find('.trafficFee').val(Math.round(trafficFeeCount*trafficFeeStandard*10000)/10000);
                var trafficFee =  Number($(this).parent().parent().find('.trafficFee').val());

                var accommodationFeeStandard =  Number($(this).parent().parent().find('.accommodationFeeStandard').val());
                var accommodationFeeCount =  Number($(this).parent().parent().find('.accommodationFeeCount').val());
                var accommodationFeeDays =  Number($(this).parent().parent().find('.accommodationFeeDays').val());
                $(this).parent().parent().find('.accommodationFee').val(Math.round(accommodationFeeStandard*accommodationFeeCount*accommodationFeeDays*10000)/10000);
                var accommodationFee =  Number($(this).parent().parent().find('.accommodationFee').val());

                var incidentalsFeeCount =  Number($(this).parent().parent().find('.incidentalsFeeCount').val());
                var incidentalsFeeStandard =  Number($(this).parent().parent().find('.incidentalsFeeStandard').val());
                $(this).parent().parent().find('.incidentalsFee').val(Math.round(incidentalsFeeCount*incidentalsFeeStandard*10000)/10000);
                var incidentalsFee =  Number($(this).parent().parent().find('.incidentalsFee').val());

                $(this).parent().parent().find('.money').val(trafficFee+accommodationFee+incidentalsFee);

                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            $('#instrumentTable .trafficFeeStandard,#instrumentTable .trafficFeeCount,#instrumentTable .trafficFee,#instrumentTable .accommodationFeeStandard,#instrumentTable .accommodationFeeCount,#instrumentTable .accommodationFeeDays,#instrumentTable .accommodationFee,#instrumentTable .incidentalsFeeCount,#instrumentTable .incidentalsFeeStandard,#instrumentTable .incidentalsFee').on('mouseleave',function () {
                var trafficFeeStandard =  Number($(this).parent().parent().find('.trafficFeeStandard').val());
                var trafficFeeCount =  Number($(this).parent().parent().find('.trafficFeeCount').val());
                $(this).parent().parent().find('.trafficFee').val(Math.round(trafficFeeCount*trafficFeeStandard*10000)/10000);
                var trafficFee =  Number($(this).parent().parent().find('.trafficFee').val());

                var accommodationFeeStandard =  Number($(this).parent().parent().find('.accommodationFeeStandard').val());
                var accommodationFeeCount =  Number($(this).parent().parent().find('.accommodationFeeCount').val());
                var accommodationFeeDays =  Number($(this).parent().parent().find('.accommodationFeeDays').val());
                $(this).parent().parent().find('.accommodationFee').val(Math.round(accommodationFeeStandard*accommodationFeeCount*accommodationFeeDays*10000)/10000);
                var accommodationFee =  Number($(this).parent().parent().find('.accommodationFee').val());

                var incidentalsFeeCount =  Number($(this).parent().parent().find('.incidentalsFeeCount').val());
                var incidentalsFeeStandard =  Number($(this).parent().parent().find('.incidentalsFeeStandard').val());
                $(this).parent().parent().find('.incidentalsFee').val(Math.round(incidentalsFeeCount*incidentalsFeeStandard*10000)/10000);
                var incidentalsFee =  Number($(this).parent().parent().find('.incidentalsFee').val());

                $(this).parent().parent().find('.money').val(trafficFee+accommodationFee+incidentalsFee);

                Instrument.prototype.calculateSumMoney();
                $("#myModalLabel font").text(total);
            });
            Instrument.prototype.calculateSumMoney();
            $("#myModalLabel font").text(total);
        }
        var instrumentLength = $('#instrumentTbody').children().length;
        Instrument.prototype.addRow = function (e) {
            var data = $('#myModalDetailSubmit').attr('data');
            if(data == '2'){
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].pressWorkName" class="input-medium pressWorkName" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].pressAccording" class="input-medium pressAccording" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].colorPressNumber" class="input-medium colorPressNumber" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].colorPressStandard" readonly class="input-medium colorPressStandard" type="text" value="'+colorPrintStandard+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].blackWhitePressNumber" class="input-medium blackWhitePressNumber" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].blackWhitePressStandard" readonly class="input-medium blackWhitePressStandard" type="text" value="'+blackWhitePrintStandard+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="'+wholePrintStandard+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].pressStandardDoc" class="input-medium pressStandardDoc" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyPriceMulNum();
            }else if(data == '3'){
                var specialistFeeOptions = '<select class="specialistType"><option value="0">请选择</option>';
                for(var k = 0;k<specialistFeeStandards.length;k++) {
                    var specialistFeeStandard = specialistFeeStandards[k];
                    var value = specialistFeeStandard.value;
                    var label = specialistFeeStandard.label;
                    var standards = specialistFeeStandard.description;
                    specialistFeeOptions += '<option standards="'+standards+'" value="' + value + '">' + label + '</option>';
                }
                specialistFeeOptions += '</select>';
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' + specialistFeeOptions+
                    // '<input name="instruments[' + instrumentLength + '].specialistType" class="input-medium specialistType" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].days" class="input-medium days" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].invitePersonMeeting" class="input-medium invitePersonMeeting" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].invitePersonCommu" class="input-medium invitePersonCommu" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].meetingStandard2" readonly class="input-medium meetingStandard2" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].commuStandard" readonly class="input-medium commuStandard" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceStandard" class="input-medium priceStandard" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberStandard" class="input-medium numberStandard" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].address" class="input-medium address" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].entertainmentExpense" class="input-medium entertainmentExpense" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                $('.specialistType').on('change',Instrument.prototype.changeSpecialistFeeStandard);
                specialistMoney();
                //电费
            }else if(data == '6') {
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].type" class="input-medium type" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="'+electricityPrice+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly readonly class="input-medium money" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].consume" class="input-medium consume" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyPriceMulNum();
                //邮电费
            }else if(data == '7') {
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="'+postagePrice+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].remark" class="input-medium remark" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].postMoney" class="input-medium postMoney" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyPriceMulNum();
            }else if(data == '11') {
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].taskName" class="input-medium taskName" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].type" class="input-medium type" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].country" class="input-medium country" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].trafficFeeStandard" readonly class="input-medium trafficFeeStandard" type="text" value="'+internationalTrafficFeeStandard+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].trafficFeeCount" class="input-medium trafficFeeCount" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].trafficFee" readonly class="input-medium trafficFee" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].accommodationFeeStandard" readonly class="input-medium accommodationFeeStandard" type="text" value="'+internationalAccommodationFeeStandard+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].accommodationFeeCount" class="input-medium accommodationFeeCount" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].accommodationFeeDays" class="input-medium accommodationFeeDays" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].accommodationFee" readonly class="input-medium accommodationFee" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].incidentalsFeeStandard" readonly class="input-medium incidentalsFeeStandard" type="text" value="'+internationalIncidentalsFeeStandard+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].incidentalsFeeCount" class="input-medium incidentalsFeeCount" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].incidentalsFee" readonly class="input-medium incidentalsFee" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                internationalCooperationMoney();
            }else if(data == '12') {
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" class="input-medium money" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyTotal();
            }else if(data == '13') {
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].condition" class="input-medium condition" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].conditionDemond" class="input-medium conditionDemond" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" class="input-medium money" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].period" class="input-medium period" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyTotal();
                //培训费
            }else if(data == '15') {
                var trainingFeeOptions = '<select class="isOurArrange"><option value="">请选择</option>';
                for(var k = 0;k<yesOrNo.length;k++) {
                    var type = yesOrNo[k];
                    var value = type.value;
                    var label = type.label;
                    trainingFeeOptions += '<option value="' + value + '">' + label + '</option>';
                }
                trainingFeeOptions += '</select>';
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].taskName" class="input-medium taskName" type="text" value="">' +
                    '</td>' +
                    '<td>' +trainingFeeOptions+
                    //'<input name="instruments[' + instrumentLength + '].isOurArrange" class="input-medium isOurArrange" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].count" class="input-medium count" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="'+trainingFeeStandard+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].address" class="input-medium address" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyCountPriceMulNum();
            }else if(data == '17') {
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].name" class="input-medium name" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].price" class="input-medium price" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyPriceMulNum();
            }else if(data == '20') {
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].count" class="input-medium count" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].price" class="input-medium price" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].explain" class="input-medium explain" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyCountPriceMulNum();
            }else if(data == '21') {
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].name" class="input-medium name" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" class="input-medium money" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].depend" class="input-medium depend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyTotal();
                //差旅费，其它交通费用
            }else if(data == '10' || data == '25') {
                var price = 0;
                if(data == '10'){
                    price = travelExpenseStandard;
                }else {
                    price = otherTrafficFeeStandard;
                }
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="'+price+'">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="0">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyPriceMulNum();
            }else if(data == '30' || data == '33'){
                $('#instrumentTable>tbody').append(
                    '<tr>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].instrumentName" class="input-medium instrumentName" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].instrumentCategory" class="input-medium instrumentCategory" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].instrumentType" class="input-medium instrumentType" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].price" class="input-medium price" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].address" class="input-medium address" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="">' +
                    '</td>' +
                    '<td>' +
                    '<a class="deleteInstrument">删除</a>' +
                    '</td>' +
                    '</tr>'
                );
                moneyPriceMulNum();
            }
            instrumentLength = instrumentLength + 1;
            $('.deleteInstrument').off('click', Instrument.prototype.remove);
            $('.deleteInstrument').on('click', Instrument.prototype.remove);
            moneyPriceMulNum();
        }

        $('.deleteInstrument').on('click',Instrument.prototype.remove);
        $('#addInstrument').on('click',Instrument.prototype.addRow);
        Instrument.prototype.changeSpecialistFeeStandard = function () {
            var $meetingStandard2 = $(this).parent().parent().find('.meetingStandard2');
            var $commuStandard = $(this).parent().parent().find('.commuStandard');
            var standards = $(this).find("option:selected").attr('standards').split('_');
            console.log(standards);
            $meetingStandard2.val(standards[0]);
            $commuStandard.val(standards[1]);
        }
        //印刷费
        $('#subjectList2money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','2');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>印刷品名称</th>'+
                '<th>印刷依据</th>'+
                '<th>用途</th>    '+
                '<th>彩色印刷页数</th>    '+
                '<th>彩色印刷标准</th>    '+
                '<th>黑白印刷页数</th>    '+
                '<th>黑白印刷标准</th>    '+
                '<th>单价(万元/本、份)</th>    '+
                '<th>印刷数量(本、份)</th>    '+
                '<th>总金额(万元)</th>    '+
                '<th>印刷标准文件(黑白、彩印)</th>    '+
                '<th>定价依据</th>    '+
                '<th>数量依据</th>    '+
                '<th>删除</th>    '+
                '</tr>'
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].pressWorkName" class="input-medium pressWorkName" type="text" value="' + detail.pressWorkName + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].pressAccording" class="input-medium pressAccording" type="text" value="' + detail.pressAccording + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="' + detail.purpose + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].colorPressNumber" class="input-medium colorPressNumber" type="text" value="' + detail.colorPressNumber + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].colorPressStandard" readonly class="input-medium colorPressStandard" type="text" value="' + detail.colorPressStandard + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].blackWhitePressNumber" class="input-medium blackWhitePressNumber" type="text" value="' + detail.blackWhitePressNumber + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].blackWhitePressStandard" readonly class="input-medium blackWhitePressStandard" type="text" value="' + detail.blackWhitePressStandard + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price" class="input-medium price" readonly type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].pressStandardDoc" class="input-medium pressStandardDoc" type="text" value="' + detail.pressStandardDoc + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyPriceMulNum ();
            }
            showModel();
        })
        //专家咨询费
        $('#subjectList3money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','3');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>专家类别</th>'+
                '<th>天数(次)</th>'+
                '<th>邀请人数(会议咨询)</th>    '+
                '<th>邀请人数(通信咨询)</th>    '+
                '<th>会议咨询标准(万元)</th>    '+
                '<th>通讯咨询标准(万元)</th>    '+
                '<th>总金额(万元)</th>    '+
                '<th>与项目任务的关系</th>    '+
                '<th>专家咨询内容</th>    '+
                '<th>聘请专家费用标准依据</th>    '+
                '<th>专家人数依据</th>    '+
                '<th>地点(交通费)</th>    '+
                '<th>招待费</th>    '+
                '<th>操作</th>    '+
                '</tr>'
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    var specialistFeeOptions = '<select class="specialistType">';
                    for(var k = 0;k<specialistFeeStandards.length;k++) {
                        var specialistFeeStandard = specialistFeeStandards[k];
                        var value = specialistFeeStandard.value;
                        var label = specialistFeeStandard.label;
                        var standards = specialistFeeStandard.description;
                        if(detail.meetingStandard2 == value) {
                            specialistFeeOptions += '<option standards="'+standards+'" selected value="' + value + '">' + label + '</option>';
                        }else {
                            specialistFeeOptions += '<option standards="'+standards+'" value="' + value + '">' + label + '</option>';
                        }
                    }
                    specialistFeeOptions += '</select>';
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +specialistFeeOptions+
                        // '<input name="instruments[' + instrumentLength + '].specialistType" class="input-medium specialistType" type="text" value="' + detail.specialistType + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].days" class="input-medium days" type="text" value="' + detail.days + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].invitePersonMeeting" class="input-medium invitePersonMeeting" type="text" value="' + detail.invitePersonMeeting + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].invitePersonCommu" class="input-medium invitePersonCommu" type="text" value="' + detail.invitePersonCommu + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].meetingStandard2" readonly class="input-medium meetingStandard2" type="text" value="' + detail.meetingStandard2 + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].commuStandard" readonly class="input-medium commuStandard" type="text" value="' + detail.commuStandard + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="' + detail.relation + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="' + detail.content + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceStandard" class="input-medium priceStandard" type="text" value="' + detail.priceStandard + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberStandard" class="input-medium numberStandard" type="text" value="' + detail.numberStandard + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].address" class="input-medium address" type="text" value="' + detail.address + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].entertainmentExpense" class="input-medium entertainmentExpense" type="text" value="' + detail.entertainmentExpense + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                $('.specialistType').on('change',Instrument.prototype.changeSpecialistFeeStandard);
                specialistMoney();
            }
            showModel();
        })
        //电费明细
        $('#subjectList6money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','6');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>使用设备情况</th>'+
                '<th>数量(度)</th>'+
                '<th>单价(万元)</th>    '+
                '<th>金额(万元)</th>    '+
                '<th>设备耗电量(功率、设备运转时间)</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].type" class="input-medium type" type="text" value="' + detail.type + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].consume" class="input-medium consume" type="text" value="' + detail.consume + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyPriceMulNum ();
            }
            showModel();
        })
        //邮电费
        $('#subjectList7money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','7');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>数量</th>'+
                '<th>单价(万元)</th>    '+
                '<th>金额(万元)</th>    '+
                '<th>备注</th>    '+
                '<th>邮寄费</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].remark" class="input-medium remark" type="text" value="' + detail.remark + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].postMoney" class="input-medium postMoney" type="text" value="' + detail.postMoney + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyPriceMulNum();
            }
            showModel();
        })
        //国际合作交流费
        $('#subjectList11money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','11');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>出国任务名称</th>'+
                '<th>类别</th>'+
                '<th>国家</th>    '+
                '<th>交通费标准(万元)</th>    '+
                '<th>交通费人数</th>    '+
                '<th>交通费金额(万元)</th>    '+
                '<th>食宿费标准(万元)</th>    '+
                '<th>食宿费人数</th>    '+
                '<th>食宿费天数</th>    '+
                '<th>食宿费金额(万元)</th>    '+
                '<th>公杂费标准(万元)</th>    '+
                '<th>公杂费人数</th>    '+
                '<th>公杂费金额(万元)</th>    '+
                '<th>总金额(万元)</th>    '+
                '<th>内容说明</th>    '+
                '<th>人数依据</th>    '+
                '<th>费用标准依据</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].taskName" class="input-medium taskName" type="text" value="' + detail.taskName + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].type" class="input-medium type" type="text" value="' + detail.type + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].country" class="input-medium country" type="text" value="' + detail.country + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].trafficFeeStandard" readonly class="input-medium trafficFeeStandard" type="text" value="' + detail.trafficFeeStandard + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].trafficFeeCount" class="input-medium trafficFeeCount" type="text" value="' + detail.trafficFeeCount + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].trafficFee" readonly class="input-medium trafficFee" type="text" value="' + detail.trafficFee + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].accommodationFeeStandard" readonly class="input-medium accommodationFeeStandard" type="text" value="' + detail.accommodationFeeStandard + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].accommodationFeeCount" class="input-medium accommodationFeeCount" type="text" value="' + detail.accommodationFeeCount + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].accommodationFeeDays" class="input-medium accommodationFeeDays" type="text" value="' + detail.accommodationFeeDays + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].accommodationFee" readonly class="input-medium accommodationFee" type="text" value="' + detail.accommodationFee + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].incidentalsFeeStandard" readonly class="input-medium incidentalsFeeStandard" type="text" value="' + detail.incidentalsFeeStandard + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].incidentalsFeeCount" class="input-medium incidentalsFeeCount" type="text" value="' + detail.incidentalsFeeCount + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].incidentalsFee" readonly class="input-medium incidentalsFee" type="text" value="' + detail.incidentalsFee + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="' + detail.content + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                internationalCooperationMoney();
            }
            showModel();
        })
        //维修（护）费用
        $('#subjectList12money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','12');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>维修(护)内容</th>'+
                '<th>金额(万元)</th>'+
                '<th>与项目关系</th>    '+
                '<th>定价依据</th>    '+
                '<th>每年维护次数，是否每年进行研究，以前年度如何（必要性）</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="' + detail.content + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="' + detail.relation + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyTotal();
            }
            showModel();
        })
        //租赁费
        $('#subjectList13money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','13');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>现有设备情况</th>'+
                '<th>租赁需求情况</th>'+
                '<th>金额(万元)</th>'+
                '<th>与项目关系</th>    '+
                '<th>定价依据</th>    '+
                '<th>租赁期限</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].condition" class="input-medium condition" type="text" value="' + detail.condition + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].conditionDemond" class="input-medium conditionDemond" type="text" value="' + detail.conditionDemond + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="' + detail.relation + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].period" class="input-medium period" type="text" value="' + detail.period + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyTotal();
            }
            showModel();
        })
        //培训费
        $('#subjectList15money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','15');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>培训任务名称</th>'+
                '<th>是否本单位组织</th>'+
                '<th>天数</th>'+
                '<th>参加人数</th>    '+
                '<th>标准(万元/天)</th>    '+
                '<th>金额</th>    '+
                '<th>培训内容说明</th>    '+
                '<th>与项目任务关系</th>    '+
                '<th>定价依据</th>    '+
                '<th>人数依据</th>    '+
                '<th>培训地点</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    var trainingFeeOptions = '<select class="isOurArrange">';
                    for(var k = 0;k<yesOrNo.length;k++) {
                        var type = yesOrNo[k];
                        var value = type.value;
                        var label = type.label;
                        if(detail.isOurArrange == value) {
                            trainingFeeOptions += '<option selected value="' + value + '">' + label + '</option>';
                        }else{
                            trainingFeeOptions += '<option value="' + value + '">' + label + '</option>';
                        }
                    }
                    trainingFeeOptions += '</select>';
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].taskName" class="input-medium taskName" type="text" value="' + detail.taskName + '">' +
                        '</td>' +
                        '<td>' +trainingFeeOptions+
                        // '<input name="instruments[' + instrumentLength + '].isOurArrange" class="input-medium isOurArrange" type="text" value="' + detail.isOurArrange + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].count" class="input-medium count" type="text" value="' + detail.count + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="' + detail.content + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="' + detail.relation + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].address" class="input-medium address" type="text" value="' + detail.address + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyCountPriceMulNum();
            }
            showModel();
        })
        //专用材料费,站网专用材料明细,实验室专用材料明细
        $('#subjectList17money,#subjectList18money,#subjectList19money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','17');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>名称</th>'+
                '<th>单价</th>'+
                '<th>数量</th>'+
                '<th>金额(万元)</th>    '+
                '<th>用途</th>    '+
                '<th>定价依据</th>    '+
                '<th>数量依据</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].name" class="input-medium name" type="text" value="' + detail.name + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price" class="input-medium price" type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="' + detail.purpose + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyPriceMulNum();
            }
            showModel();
        })
        //劳务费
        $('#subjectList20money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','20');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>人数</th>'+
                '<th>月数</th>'+
                '<th>发放标准(万元)</th>'+
                '<th>金额(万元)</th>    '+
                '<th>与项目关系</th>    '+
                '<th>发放说明</th>    '+
                '<th>定价依据</th>    '+
                '<th>数量依据</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].count" class="input-medium count" type="text" value="' + detail.count + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price" class="input-medium price" type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="' + detail.relation + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].explain" class="input-medium explain" type="text" value="' + detail.explain + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyCountPriceMulNum();
            }
            showModel();
        })
        //委托业务费
        $('#subjectList21money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','21');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>委托业务名称</th>'+
                '<th>金额(万元)</th>'+
                '<th>内容说明</th>'+
                '<th>用途</th>    '+
                '<th>测算依据</th>    '+
                '<th>删除</th>    '+
                '</tr>            '
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].name" class="input-medium name" type="text" value="' + detail.name + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="' + detail.content + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="' + detail.purpose + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].depend" class="input-medium depend" type="text" value="' + detail.depend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyTotal();
            }
            showModel();
        })
        //差旅费，其它交通费
        $('#subjectList10money,#subjectList25money').on('click',function () {
            $("#myModalLabel font").text("0");
            var subjectCode = $(this).attr('subjectCode');
            if(subjectCode == '30210'){
                $('#myModalDetailSubmit').attr('data','10');
            }else{
                $('#myModalDetailSubmit').attr('data','25');
            }
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>人数</th>'+
                '<th>标准(万元)</th>'+
                '<th>金额(万元)</th>    '+
                '<th>与项目关系</th>    '+
                '<th>地点、路线、工作内容</th>    '+
                '<th>定价标准依据</th>    '+
                '<th>人数依据</th>    '+
                '<th>删除</th>    '+
                '</tr>'
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price" readonly class="input-medium price" type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].relation" class="input-medium relation" type="text" value="' + detail.relation + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="' + detail.content + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
                moneyPriceMulNum();
            }
            showModel();
        })
        //办公设备购置，专用设备购置，业务办公耗材
        $('#subjectList29money,#subjectList30money,#subjectList31money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','30');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>名称</th>'+
                '<th>设备分类</th>'+
                '<th>设备型号</th>    '+
                '<th>单价(万元/台)</th>    '+
                '<th>数量(台、件)</th>    '+
                '<th>总金额(万元)</th>    '+
                '<th>内容说明</th>    '+
                '<th>购置设备生产国别与地区</th>    '+
                '<th>用途</th>    '+
                '<th>定价依据</th>    '+
                '<th>数量依据</th>    '+
                '<th>删除</th>    '+
                '</tr>'
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].instrumentName" class="input-medium instrumentName" type="text" value="' + detail.instrumentName + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].instrumentCategory" class="input-medium instrumentCategory" type="text" value="' + detail.instrumentCategory + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].instrumentType" class="input-medium instrumentType" type="text" value="' + detail.instrumentType + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price"  class="input-medium price" type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="' + detail.content + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].address" class="input-medium address" type="text" value="' + detail.address + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="' + detail.purpose + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
            }
            moneyPriceMulNum();

            showModel();
        })
        //信息网络及软件购置更新
        $('#subjectList33money').on('click',function () {
            $("#myModalLabel font").text("0");
            $('#myModalDetailSubmit').attr('data','33');
            $('#myModalLabel b').text($(this).attr('subjectName'));
            $('#instrumentTable>thead').empty();
            $('#instrumentTable>thead').append(
                '<tr>             '+
                '<th>设备名称</th>'+
                '<th>设备分类</th>'+
                '<th>设备型号</th>    '+
                '<th>单价(万元/台)</th>    '+
                '<th>数量(台 件)</th>    '+
                '<th>总金额</th>    '+
                '<th>主要技术性能指标</th>    '+
                '<th>购置设备生产国别与地区</th>    '+
                '<th>用途</th>    '+
                '<th>定价依据</th>    '+
                '<th>数量依据</th>    '+
                '<th>删除</th>    '+
                '</tr>'
            );
            $('#instrumentTable>tbody').empty();
            console.log($(this).next().next());
            $current = $(this);
            $currentDetail = $(this).next().next();
            var detailsJson = $currentDetail.val();
            if(detailsJson) {
                var details = JSON.parse($currentDetail.val());
                var i = 0;
                for(;i<details.length;i++){
                    var detail = details[i];
                    $('#instrumentTable>tbody').append(
                        '<tr>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].instrumentName" class="input-medium instrumentName" type="text" value="' + detail.instrumentName + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].instrumentCategory" class="input-medium instrumentCategory" type="text" value="' + detail.instrumentCategory + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].instrumentType" class="input-medium instrumentType" type="text" value="' + detail.instrumentType + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].price" class="input-medium price" type="text" value="' + detail.price + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].number" class="input-medium number" type="text" value="' + detail.number + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].money" readonly class="input-medium money" type="text" value="' + detail.money + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].content" class="input-medium content" type="text" value="' + detail.content + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].address" class="input-medium address" type="text" value="' + detail.address + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].purpose" class="input-medium purpose" type="text" value="' + detail.purpose + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].priceDepend" class="input-medium priceDepend" type="text" value="' + detail.priceDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<input name="instruments[' + instrumentLength + '].numberDepend" class="input-medium numberDepend" type="text" value="' + detail.numberDepend + '">' +
                        '</td>' +
                        '<td>' +
                        '<a class="deleteInstrument">删除</a>' +
                        '</td>' +
                        '</tr>'
                    );
                }
            }
            moneyPriceMulNum();
            showModel();
        })
        var details = [];
        Instrument.prototype.calculateSumMoney = function (e) {
            details = [];
            total = 0;
            var data = $('#myModalDetailSubmit').attr('data');
            //印刷费
            if(data == '2') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.pressWorkName = $(this).find('.pressWorkName').val();
                    detail.pressAccording = $(this).find('.pressAccording').val();
                    detail.purpose = $(this).find('.purpose').val();
                    detail.colorPressNumber = $(this).find('.colorPressNumber').val();
                    detail.colorPressStandard = $(this).find('.colorPressStandard').val();
                    detail.blackWhitePressNumber = $(this).find('.blackWhitePressNumber').val();
                    detail.blackWhitePressStandard = $(this).find('.blackWhitePressStandard').val();
                    detail.price = $(this).find('.price').val();
                    detail.number = $(this).find('.number').val();
                    detail.money = $(this).find('.money').val();
                    detail.pressStandardDoc = $(this).find('.pressStandardDoc').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.numberDepend = $(this).find('.numberDepend').val();
                    detail.money = $(this).find('.money').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
            }
            //专家咨询费
            else if(data == '3') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.specialistType = $(this).find('.specialistType').val();
                    detail.days = $(this).find('.days').val();
                    detail.invitePersonMeeting = $(this).find('.invitePersonMeeting').val();
                    detail.invitePersonCommu = $(this).find('.invitePersonCommu').val();
                    detail.meetingStandard2 = $(this).find('.meetingStandard2').val();
                    detail.meetingStandard3 = $(this).find('.meetingStandard3').val();
                    detail.commuStandard = $(this).find('.commuStandard').val();
                    detail.relation = $(this).find('.relation').val();
                    detail.content = $(this).find('.content').val();
                    detail.money = $(this).find('.money').val();
                    detail.priceStandard = $(this).find('.priceStandard').val();
                    detail.numberStandard = $(this).find('.numberStandard').val();
                    detail.address = $(this).find('.address').val();
                    detail.entertainmentExpense = $(this).find('.entertainmentExpense').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
            }
            //电费
            else if(data == '6') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.type = $(this).find('.type').val();
                    detail.number = $(this).find('.number').val();
                    detail.price = $(this).find('.price').val();
                    detail.money = $(this).find('.money').val();
                    total += Number(detail.money);
                    detail.consume = $(this).find('.consume').val();
                    details.push(detail);
                })
            }//邮电费
            else if(data == '7') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.number = $(this).find('.number').val();
                    detail.price = $(this).find('.price').val();
                    detail.money = $(this).find('.money').val();
                    detail.remark = $(this).find('.remark').val();
                    detail.postMoney = $(this).find('.postMoney').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //其它交通费用,差旅费
            }else if(data == '11') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.taskName = $(this).find('.taskName').val();
                    detail.type = $(this).find('.type').val();
                    detail.country = $(this).find('.country').val();
                    detail.trafficFeeStandard = $(this).find('.trafficFeeStandard').val();
                    detail.trafficFeeCount = $(this).find('.trafficFeeCount').val();
                    detail.trafficFee = $(this).find('.trafficFee').val();
                    detail.accommodationFeeStandard = $(this).find('.accommodationFeeStandard').val();
                    detail.accommodationFeeCount = $(this).find('.accommodationFeeCount').val();
                    detail.accommodationFeeDays = $(this).find('.accommodationFeeDays').val();
                    detail.accommodationFee = $(this).find('.accommodationFee').val();
                    detail.incidentalsFeeStandard = $(this).find('.incidentalsFeeStandard').val();
                    detail.incidentalsFeeCount = $(this).find('.incidentalsFeeCount').val();
                    detail.incidentalsFee = $(this).find('.incidentalsFee').val();
                    detail.content = $(this).find('.content').val();
                    detail.money = $(this).find('.money').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.numberDepend = $(this).find('.numberDepend').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //维修(护)费
            }else if(data == '12') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.content = $(this).find('.content').val();
                    detail.money = $(this).find('.money').val();
                    detail.relation = $(this).find('.relation').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.numberDepend = $(this).find('.numberDepend').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //租赁费
            }else if(data == '13') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.condition = $(this).find('.condition').val();
                    detail.conditionDemond = $(this).find('.conditionDemond').val();
                    detail.money = $(this).find('.money').val();
                    detail.relation = $(this).find('.relation').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.period = $(this).find('.period').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //培训费
            }else if(data == '15') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.taskName = $(this).find('.taskName').val();
                    detail.isOurArrange = $(this).find('.isOurArrange').val();
                    detail.count = $(this).find('.count').val();
                    detail.number = $(this).find('.number').val();
                    detail.price = $(this).find('.price').val();
                    detail.money = $(this).find('.money').val();
                    detail.content = $(this).find('.content').val();
                    detail.relation = $(this).find('.relation').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.numberDepend = $(this).find('.numberDepend').val();
                    detail.address = $(this).find('.address').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //专用材料费
            }else if(data == '17') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.name = $(this).find('.name').val();
                    detail.price = $(this).find('.price').val();
                    detail.number = $(this).find('.number').val();
                    detail.money = $(this).find('.money').val();
                    detail.purpose = $(this).find('.purpose').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.numberDepend = $(this).find('.numberDepend').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //劳务费
            }else if(data == '20') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.count = $(this).find('.count').val();
                    detail.number = $(this).find('.number').val();
                    detail.price = $(this).find('.price').val();
                    detail.money = $(this).find('.money').val();
                    detail.relation = $(this).find('.relation').val();
                    detail.explain = $(this).find('.explain').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.numberDepend = $(this).find('.numberDepend').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //委托业务费
            }else if(data == '21') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.name = $(this).find('.name').val();
                    detail.money = $(this).find('.money').val();
                    detail.content = $(this).find('.content').val();
                    detail.purpose = $(this).find('.purpose').val();
                    detail.depend = $(this).find('.depend').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //差旅费 其它交通费用
            }else if(data == '10' || data == '25') {
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.number = $(this).find('.number').val();
                    detail.price = $(this).find('.price').val();
                    detail.money = $(this).find('.money').val();
                    detail.relation = $(this).find('.relation').val();
                    detail.content = $(this).find('.content').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.numberDepend = $(this).find('.numberDepend').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
                //专用设备购置
            }else if(data == '30' || data == '33'){
                $('#instrumentTable>tbody').children().each(function () {
                    var detail = {};
                    detail.instrumentName = $(this).find('.instrumentName').val();
                    detail.instrumentCategory = $(this).find('.instrumentCategory').val();
                    detail.instrumentType = $(this).find('.instrumentType').val();
                    detail.price = $(this).find('.price').val();
                    detail.number = $(this).find('.number').val();
                    detail.money = $(this).find('.money').val();
                    detail.content = $(this).find('.content').val();
                    detail.address = $(this).find('.address').val();
                    detail.purpose = $(this).find('.purpose').val();
                    detail.priceDepend = $(this).find('.priceDepend').val();
                    detail.numberDepend = $(this).find('.numberDepend').val();
                    total += Number(detail.money);
                    details.push(detail);
                })
            }
            total = Math.round(total*10000)/10000;
        }
        $('#myModalDetailSubmit').on('click',function () {
            Instrument.prototype.calculateSumMoney();
            $current.val(total);
            $current.trigger("change");
            $currentDetail.val(JSON.stringify(details));
            $('#myModal').modal('hide');
        });

    })(jQuery);
})